<?php

namespace App\Http\Controllers\admin\api;

use App\Http\Controllers\admin\validate\Common;
use App\Http\Controllers\utils\ToolUtil;
use Illuminate\Http\Request;
use App\Http\Controllers\utils\LogUtil;
use Illuminate\Support\Facades\DB;

class CommonApi{



    public static function getAccountType(Request $request){

        $param = $request->all();
        if(empty($param['type'])){
            $res = DB::table('t_group')->where('group_id',3)->orWhere('group_id',4)->get(['id as type_id','title'])->toArray();
        }else{
            $type = (int)$param['type'];
            $res = DB::table('t_group')->where('group_id',$type)->get(['id as type_id','title']);
        }

        if(count($res)){
            return ToolUtil::returnJson(200,'成功',$res);
        }
        return ToolUtil::returnJson(400,'没有数据.');

    }



}
